package com.drama.api.sys.order.controller;

import cn.dev33.satoken.annotation.SaCheckLogin;
import com.drama.api.base.ApiIndex;
import com.drama.api.base.R;
import com.drama.api.base.RestPage;
import com.drama.api.company.order.domain.vo.CompanyOrderCountVO;
import com.drama.api.sys.order.domain.vo.*;
import com.drama.api.sys.order.service.IOrderRechargeService;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@Api( tags = ApiIndex.SysOrderRechargeController)
@RequestMapping(value = "/api/sys/recharge")
@RestController
@SaCheckLogin
public class SysOrderRechargeController {

    @Autowired
    private IOrderRechargeService service;

    @ApiOperation(value = "查询充值收益统计")
    @GetMapping(value = "/count")
    public R<SysOrderRechargeCountVO> get_count() {
        CompanyOrderCountVO countVO = service.getCount();
        return new R(countVO);
    }

    @ApiOperation(value = "查询充值收益统计集合")
    @GetMapping(value = "/count_list")
    public R<RestPage<List<SysOrderRechargeListVO>>> count_list(
            @ApiParam(value = "查询参数") @ModelAttribute SysOrderRechargeSearchVO searchVO) {
        List<SysOrderRechargeListVO> list = service.getCountList(searchVO);
        RestPage restPage = new RestPage(new PageInfo(list), list);
        return new R(restPage);
    }

    @ApiOperation(value = "查询充值收益统计集合合计")
    @GetMapping(value = "/count_list_total")
    public R<SysOrderRechargeListVO> count_list_total(
            @ApiParam(value = "查询参数") @ModelAttribute SysOrderRechargeListTotalVO searchVO) {
        SysOrderRechargeListVO vo = service.getCountListTotal(searchVO);
        return new R(vo);
    }

    @ApiOperation(value = "查询充值收益订单明细")
    @GetMapping(value = "/list")
    public R<RestPage<List<SysOrderRechargeVO>>> list(
            @ApiParam(value = "查询参数") @ModelAttribute SysOrderRechargeSearchVO searchVO) {
        List<SysOrderRechargeVO> list = service.getList(searchVO);
        RestPage restPage = new RestPage(new PageInfo(list), list);
        return new R(restPage);
    }




}
